package org.mango.kryo.coder;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import org.mango.kryo.serializer.KryoSerializer;

import java.util.List;

/**
 * Created by meigang on 2019/8/8.
 */
public class KryoDecoder extends ByteToMessageDecoder {
    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
        Object obj = KryoSerializer.deserialize(byteBuf);
        list.add(obj);
    }
}
